<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;

class Food extends Model{
    //protected $connection = 'connection-name';
    protected $table = 'food';
    protected $primarykey = 'id';
    //指定允许批量赋值的字段
    protected $fillable = ['name','content'];
    //指定不允许批量赋值的字段
    //protected $guarded = [];
    public $timestamps = false;//存在created_at 和 updated_at字段
    protected $casts = [
        'age' => 'integer',
    ];
    protected function getDateFormat(){
        return time();
    }
    protected function asDateTime($value)
    {
        return $value;
    }
}